I've been using my iMac (mid-2011, OS X Yosemite 10.10.1) without any problems since I purhaced it. However, today a distracting yellow square pattern started to appear. It only appears over application windows, ie. I can't see any pattern over my desktop, but my browser is covered with it. It doesn't appear on every window, but almost all of them. The pattern moves if I scroll and it does change if I refresh a webpage. It also appears on screenshots I take.
I've tried rebooting and updating my OS without any change.
What could cause this and is there anything I can do to fix it?
Update #1 All application windows (including OpenGL games) are either distorted or covered with yellow pattern. I said earlier that not all windows were affected, but I was wrong.
Update #2 Opening my computer using safe mode (pressing shift key right after the boot up sound) removes the yellow pattern, but introduces another screen bug. Now the windows are flashing. A white bar starts from the bottom of the window and moves to the top (at least 2-3 times per second).