Fix grid coordinates computation. Now always return top-left corner of the cell.