helpers for getting offsets from edges of viewport