Function checks if the rect is visible