Does something else make you think this is a frame/chassis issue aside from the aftermarket window fitment?
The rear ROPS is one single piece. It's either straight or it is not. You're not going to adjust the "square" of it with a ratchet strap as suggested. You'd pretty much need a frame rack.
Bend a small wire, cut a piece of cardboard etc. to fit one corner of the inset where the window goes, then flip it over and see if it fits in the opposite corner. Do the same test with the window. This should show you where the problem is.
The driver side rear pillar is more of a straight line vs the passenger side that slopes more in at the top. The panel fit in without the gasket and it would appear to be more symmetrical then the ROPS/frame. I will take another picture when I get home from work. I bought this preowned/used so I don't think there will be any warranty claims.
This pic is taking straight on from the rear. Ignore the lack of hardware on the rear panel (trying to wiggle it every way we could). The roof is also lifted up to have better access to the bolts. I have not tried to loosen all the bolts for the rear section of the ROPS/cage and then use a hand winch to try to pull over the drivers side to square it all up.
The right rear corner of the bed looks lower than the left rear corner. The right shock looks longer than the left shock and appears to be at a different angle. I attribute all this to a major accident or, more likely, it being a 3 dimensional object viewed in a 2 dimensional format. In other words, this picture is useless to us. Several suggestions have been made on how to check the "square" of the rear ROPS section.
Again, you are not going to be able to use simple manual equipment to change the square of that rear ROPS member. You would need to chain the machine to the floor and apply several tons of pressure at the upper corners to move that thing. If a ratchet strap or hand winch could bend that single piece then the ROPS would be useless in even a soft rollover situation...God help anybody involved in a violent one.
Do you have a front windshield installed?. If yes, does it fit correctly with no gaps/issues. I'm in agreement with Renob4x4 that you might have to loosen the cage bolts, try to square it, re-tighten the bolts.