What are these strange red and blue squares?

Solution 1:

The blue square acts as a potion of purity/Zodiac wand: it will remove buffs and debuffs. (I think it only removes 1 hit from buffs that are related to being hit/hitting X times) The red square will debuff you (lower sight radius) and summon 4 monsters.

Solution 2:

Sometimes it gives you a buff (I can't remember exactly what the buff did), but most of the time, in my experience, it gives you a debuff which decreases sight range, as well as spawning four monsters around you.