Fix off-by-one error in center_2d_coordinates