Fix heap corruption on getRectSubPix