Something like this? Pseudocode, of course, four nested loops is unsightly and can probably be refactored depending on your code, e.g. foreach tile process tile.
for (tileY = 0; tileY < h / tileH; ++tileY)
for (tileX = 0; tileX < w / tileW; ++tileX)
for (y = tileY * tileH; y < (tileY + 1) * tileH; ++y)
for (x = tileX * tileW; x < (tileX + 1) * tileW; ++x)
// do stuff on pixel (x, y)
Obviously the image needs to split properly into tiles of the specified dimension (tileW, tileH), otherwise you'll need to handle the leftover pixels somehow.
The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.
- Pessimal Algorithms and Simplexity Analysis