There was a mistake in the variables saved and when resolution of the UI was not 1.0, the viewport was offset.