The picam returns an image that is 2592x1944 and it is downscaled to display in the camera view window. The interactive ROI setting in this situation doesn't work properly, presumably because it is not taking account of the
image scaling in the display.
Could quite see where my logic was wrong but there was duplicated code in the shift for square region which worked so I just tidied it up so it used this code for all cases and this works now.
The picam returns an image that is 2592x1944 and it is downscaled to display in the camera view window. The interactive ROI setting in this situation doesn't work properly, presumably because it is not taking account of the image scaling in the display.