Added rect flipping for good measure