>>11580717It's E.
Colour, red and blue, is irrelivent, and is just there to make sure you properly rotated the last shape. Where grey and white touch, adjacent squares switch. There are 4 switches in the first, because grey and white touch along 4 edges. So, red moves into white, and blue moves into white, then blue moves into white where red originally was, just as red moves into white where blue originally was. Then you have the picture on the right, which matches.
This works for the middle row too, where there is two such edges. So, the two white squares at the top switch (which you don't notice because they are the same), and the two coloured squares at the bottom switch, getting you the picture on the right.
You do the same for the last square, on which there are 4 such edges. Switch blue and red. Switch bottom white. Switch top and bottom. You have E.