Avoid redundantly setting viewport parameters in BeginFrame.

- Cache the old resolution, scroll and zoom in BeginFrame, and don't bother updating the viewport parameters again until they change.
- Pass around scroll as an int2 to reduce the number of back-and-forth casts.
Merge pull request #5540 from RoosterDragon/begin-frame-cache-viewport

Avoid redundancy in BeginFrame.