Fix some funky behaviour

see commits. Mostly relevant for rotated framebuffers and those with viewports.