This demonstration is an example of the assimilation or "spreading" effect. The blue or yellow (depending on the diagonal) areas adjacent to the red squares influence the appearance of the red squares. The yellow make the red appear lighter and the blue make the red appear darker. This is because the blue is a considerably darker color than the yellow. You may also note that the yellow casts a slight yellowish tinge on the red squares and the blue a very slight bluish tinge. It is as if a blending of colors occurs.
This phenomenon is the opposite of a contrast effect where one expects near by colors to accentuate the differences between adjacent areas.
Hurvich and Jameson believe that the physiological basis for the assimilation phenomenon is the spatial nonuniformity of the retina and its cellular organization. If the reader would like more information on their theorizing I recommend taking a look at pages 175-177 in COLOR VISION by Leo M. Hurvich (Sinauer Assoc. Inc. Publisher) 1981.