Calculate UI scale and offset.

This is the first step towards the virtual UI resolution.