Macbook Pro Retina 15" (mid 2012) screen is glitching in specific situations
Very likely your MacBook has a defective GPU. You are lucky however, since there is a recall for your specific model. 

Check your eligibility here and contact AppleCare.