I think you have Patello-femoral pain syndrome which is characterised by pain felt behind the kneecap. Squatting, walking up and down hills or stairs, or sitting still for extended periods of time can exacerbate the pain. The usual cause is abnormal movement of the kneecap as the knee is bent and straightened, and this can lead to wear and tear of the cartilage on the back of the kneecap. Imbalances in muscle strength, tight muscles, and structural abnormalities of the lower limb can cause the problem. The pain usually comes on gradually over time.
At the moment you are doing the right thing, rest it until you are confident the injury has healed. BTW make sure you don't drink alcohol and don't massage the joint both these can cause swelling and bleeding. It also might be a fair bet to bandage the knee. However, if the injury doesn't heal you rbest bet is to see a doctor or physiotherapist. You might also want to check if you are squatting with correct technique.