This behavior doesn't match the comments; it looks like you should be passing the world coordinates for the viewport instead?