I have seen in most of the block diagrams of SMPS of isolated topologies, that the input AC voltage is first rectified and filtered to DC voltage. Then, it is passed through a high frequency switch to form a square pulse, which is then stepped up/down using a transformer, after which, it is again rectified and filtered, before giving it to the output. Also, a feedback is taken from the output, which is given to the controller, which gives the PWM to the high frequency switch.
My question is that, why are we rectifying the AC input in the beginning and then again inverting it to form a square pulse, before it is passed onto the transformer. Can we directly give the input from the AC mains to the transformer, and then rectify it.