You have to watch the case when the quad wraps around from right to
left. On a 4x4 grid, the last quad on the first row has indices (2, 3,
6, 7) and the next quad should have (4, 5, 8, 9). In your case it
instead has (3, 4, 7, 8), making a degenerate quad and that odd looking
image you get. Sorry I don't have a picture but try drawing it
if it's unclear.