Your legs could be shaking because of the nyquil, especially if you just took a pain reliever before hand. I can't take Nyquil at all because, even though I sleep great, I wake up a little shakey with heart palpitations.
If you have an electrical heating pad, keep one at your bed side ready to turn on so you won't have to do too much moving. You were probably about to pass out from the pain and also from having lost blood. Are you anemic at all? Also, if you've just started having your periods this can be like getting hit with a brick wall for some girls. Mine were so bad when I first started but got better after a few years, and even more better once I went on the pill.
There's a pressure point just in the area of your belly button. If you press on it with moderate pressure for a few seconds and then let go this can help with the cramps. It works for me.