The short answer to your question is: you are taking the medication prescribed by your doctor in order to regulate your menstrual cycle and ease your discomfort. The medication is achieving this effect. Neither you or your doctor intends that this medication be used for the purpose of birth control. In your case the situation is made even clearer by the fact that you are not sexually active and do not intend to be so. So your assumption that there is no sin involved in your taking the contraceptive in these circumstances is correct.
Now some background. The Church has a traditional guideline for determining the morality of such an action. It is called “the principle of double effect.” This applies to actions where two effects will follow, one bad and the other good. In order for a person to perform such an action, four conditions must be present:
1. The act itself must be morally good or at least indifferent.
2. The agent (person performing the act) may not positively will the bad effect but may merely permit it. The bad effect is sincerely not intended.
3. The good effect must be produced directly from the action, not the bad effect.
4. The good effect must be sufficiently desirable to compensate for allowing the bad effect.
The sum of these is that the good effect of an action is what is directly willed and the bad effect is an unintended by-product of the action.
In this case your intention is to regulate your cycle and ease your pain. You have no intention to practice birth control, and in fact have every intent to live a chaste life as a single person. Therefore your conscience can be clear!