Take viewport offset into account