I don't think it's common knowledge just how long the Catholic Church has been teaching a thoroughly misguided view of sexuality. St. Thomas Aquinas is the most important theologian of the Middle Ages. He discusses sexuality (and pretty much every other question of theology and ethics) in his Summa Theologiae. The sex bits come at IIa.IIa3.Q94, or you can just follow the link here.
Go down to #11, where Aquinas talks about "the unnatural vice." There are 4 kinds of unnatural vice: homosexuality, bestiality, masturbation, and (if I'm reading him correctly) getting off in weird ways.
This may happen in several ways. First, by procuring pollution, without any copulation, for the sake of venereal pleasure: this pertains to the sin of "uncleanness" which some call "effeminacy." Secondly, by copulation with a thing of undue species, and this is called "bestiality." Thirdly, by copulation with an undue sex, male with male, or female with female, as the Apostle states (Romans 1:27): and this is called the "vice of sodomy." Fourthly, by not observing the natural manner of copulation, either as to undue means, or as to other monstrous and bestial manners of copulation.Now go down to #12, "Whether the unnatural vice is the greatest sin among the species of lust?" Aquinas answers: Yes. Yes, it is. Homosexuality and masturbation are worse than adultery. Worse than incest. Worse than rape. Why?
Wherefore just as in speculative matters the most grievous and shameful error is that which is about things the knowledge of which is naturally bestowed on man, so in matters of action it is most grave and shameful to act against things as determined by nature. Therefore, since by the unnatural vices man transgresses that which has been determined by nature with regard to the use of venereal actions, it follows that in this matter this sin is gravest of all.It's contrary to nature "with regard to the use of venereal actions," that's why! The penis isn't going where it's supposed to be going! Compared to the proper mutual arrangement of the genitals, matters such as the consent of the parties involved or the sacred bond of marriage are relatively minor matters.
If you read Objection 1 and then the reply to Objection 1 in #12, you'll see that Aquinas considers, and explicitly rejects, the notion that adultery and rape are worse than masturbation and homosexual behavior. His reply to the objection is that rape is only a sin against charity (love), while masturbation is a sin against nature, and hence a sin against God, "the author of nature" -- and sins against God are worse than sins against love. (Duh.)
The reasoning here is so clear and obvious! Once you take the premises as a given, it all follows. Being unnatural is worse than being unloving. And the definition of sexual nature is all about genital placement. All done!
It only falls apart if you step back and think for one second about your conclusion. And then, I suppose, it only falls apart if you have any experience whatever of what it means to be in a committed, loving, sexual relationship.
Imagine a priest who took this seriously. "Forgive me, Father, for I have sinned. I raped my daughter." "This is a very serious sin. But what about the important question: have you stopped masturbating?" And yet this is the official position of probably the single most important theologian (along with Augustine) who has shaped Catholic theology and ethics.