Generalized withViewport to MonadIO.