The upper limits need to be one less than the screen sizes because the minimum co-ordinate is zero instead of one.