Thanks for the query to H.C.M. Forum.
As you stated that you were studying over a couch for 2-3 hours .
Due to continue sitting the muscle cramps
over front of thigh developed pain .
As ( spasm ) cramps relieved pain subsides , this is a natural process.
It was mere coincidence that pain occurs with period.
So in my opinion need not to worry.
If pain reoccurs again then it is a cause of concern.
If reoccurs during menses then consult a gynecologist and get his opinion.
Good luck. Dr.HET