Do proper rounding in set_viewport.

Avoids edge cases where viewport sizes are miscalculated with -1 pixel
due to rounding errors.