Don't know what's the tile size relevance, since you care only about the horizontal amount of tiles in the pictured ordering scheme.
x := id mod row_width; y := id div row_width;