calculate proper refresh coordinates when using viewport

The viewport offset used by refresh() was not properly adapted when
the screen was rotated.