Fixed issue with some corner case of submatrix detection not being found on the y axis since we only iterated through the x axis.