Repeating Tiled Piecewise Function Help

I have a piecewise 2-input function that I would like to repeatedly tile diagonally across a grid. See this image.

So here, I know the equations of the pink, blue and green areas in the range 0 - 2.

My problem is that i'm having trouble finding a way to tile the function diagonally across like shown in the image by transforming the inputs. I tried using mod (x1 = x1 mod 2, x2 = x2 mod 2) to transform the input, and it worked somewhat, but it was wrong at grids (2-3, 1-2), (1-2, 2-3), (4-5, 3-4) and (3-4, 4-5). Any help is appreciated!

-
It is not really clear what you are asking. Perhaps explain what you mean by "equation of pink etc in range 0-2"? What is x_1, x_2 etc –  Aryabhata Nov 5 '10 at 2:18
x1, and x2 are the axes, and inputs to the function. Probably should have used x and y instead. By equation of pink, i meant some 2-input function e.g. x1*x2 defined from 0 - 1 as shown on the image. And similarly I have different 2-input equations for the first green and blue blocks in the lower left. –  Projectile Fish Nov 5 '10 at 2:59

Let $F$ be the original functions, $f$ the new one. Define
$f(x,y) = F(x-m,y-m)$ where $m = \min(\lfloor x \rfloor, \lfloor y \rfloor)$.