It sounds like a VMO problem. Do you have wasting of the muscle where it is painful? Has anyone tested the mobility of your kneecap?
Basically you have stabilisers to the kneecap and one of this is in the area you describe (VMO). What you need to do is a VMO strength programme. Basic exercise is the SLR with a variation. Lie on the floor facing up, then twist your leg from your hip outwards keeping the leg straight. Then lift the leg off the floor as high as you can without pain. The progression from that is squats for VMO. You can do them leaning with our back against the wall first (these are easier as you are taking less of your body weight). Have your feet set at 10 to 2 and away from the wall and then bend your knees out towards your toes. Make sure though (VERY IMPORTANT) that your knee don't go over your toes. If they do move you feet further away from the wall. After these are ok, move to squats without the wall, again make sure your knees don't go over your toes - its more of a stick your bum out and sit back movement than a bend forward. Once you've mastered the squat two-legged you need to do them one-legged.
This is justa starter of exercises. If any pain then obviously stop. If you get pain or no improvement please book in to see someone