Apply viewport before rendering json or png. See GH-48.