I should be able to figure this out, but my brain isn't cooperating with me. Say I have a grid of 5x5, with each cell in the grid numbered from 0-24, going from left to right. Given a cell number such as 17, how do I determine that cell's x and y coordinates? I've been able to do it vice versa, where if given the coordinates I can calculate cell number:
$Cell number=x+y*width$
(The x and y coordinates represent the upper left point of each cell)
But now I want the opposite. Any ideas?