This basically becomes a set of simple math problems. You have a 40A controller, with a 100Voc max limit. You can NOT wire all four of your panels in series. That would give you a 148.8Voc, far higher that what your controller can handle. You could wire them in parallel, which would give you 33amps at 30.1V. Four parallel strings though at relatively low voltage will allow for some voltage drop because you are pushing so many amps through wire at relatively low voltage. A second consideration is that with four parallel strings, fusing/breakers is mandatory!
The best configuration with your equipment would be 2S2P, that is two parallel strings of two panels in series. That would be delivering ~ 8.3A + 8.3A at 60.2V to the controller. The Voc for two in series would be only 74.4Voc, which is safely below the 100V limit. Even below freezing, that panel configuration will still be below 100V.
So, your numbers into the controller are ~16A at about 74V. Here's a chart documenting what wire can handle. So, standard 10 gauge copper wire will handle the 16A going into your controller.
Now, for the math for the power coming out of the controller.
You have two strings of two panels, producing a total of 1000W of power. The controller is going to take that raw solar power and transform it down to battery CHARGING voltage, creating extra amps with the extra volts. Assume the battery will charge at least 25V. So the math becomes 1000W/25V = 40A. Luckily, you have a 40A controller so you won't be exceeding the controllers amp limit. But, you'll need thicker wire coming out of the controller than what's going in. To safely handle at least 40A of current, looking at the chart, you need at least 8 gauge wire, though for a significant safety margin, I'd go with at least 6 gauge. I personally went with 4 gauge.
The same numbers would apply to the inverter, so I would go with 4 gauge coming out of the controller, and 4 gauge going from the battery to the inverter.
The last issue will be the fuses or breakers. The recommendation is protection 1.5X the amperage flowing through the circuit. According to code, if you only have two parallel strings of panels, you don't need protection, but I personally like having breakers, because it greatly simplifies troubleshooting when something goes wrong.
I'm partial to Midnight Solar products, so I'd recommend their three breaker combiner.
Free Shipping! MidNite Solar MNPV3 Combiner Box, 60A for 3 PV Breakers or 2 Fuseholders
ressupply.com
You'll want to use breakers 1.5X times your current, which if around 8A, you'll want a 12A breaker. Downstream of the controller with as much as 40A going into the batteries, you'll want a 60A breaker. You can go with the same rated fuses if you don't want breakers, but keep in mind you never want to disconnect a live DC circuit under load. Nasty arcs can be made.
The last thing I can comment on is that 28A is far too small a battery for this amount of current. For this sized system I'd go with at least 250Ah. A Trojan T-105 bank would be a better choice. Even Costco has a 210Ah golf-cart battery that would be far better than what you want in place.
Good luck to you!