There are three fonts of morality: intention, moral object, circumstances. To be moral, an act must have three good fonts. If one or more fonts is bad, the act is a sin. When the object of an act is evil, the act is termed intrinsically evil. It is always a sin to intentionally choose to commit an intrinsically evil act.
There seems to be a lot of confusion about the distinction between the font of morality called intention (the intended end, the purpose or reason for choosing the act) and the font called moral object. Here is a nice quote from an article by Janet Smith on the distinction:
“The moral tradition of the Church has spoken of a finis operantis/agentis and a finis operis/actus; that is, it speaks of both the intention of the agent (finis operantis/agentis) which is also known as the end of the agent (and sometimes the motive) and the end of the act itself (finis operis/actus) which is the object of the act. The finis operis/actus is a telos/end, ordination, meaning, or character of an act that is inherent in an act and so intrinsic to it or “embedded” in it that one cannot choose that action without also choosing that end along with any other further ends the agent might have. A whole moral act, the particular act of a particular human being that is either a sin or an act of merit, includes both a finis operantis and the finis operis (sometimes they are the same, as when one gives alms to benefit the poor; sometimes they are different, as when one gives alms as a part of an act of seduction). Both must be ordered to right reason, and both must be ordered to each other. For instance, one cannot kill an innocent person (the object or finis operis) to gain an inheritance to feed the hungry (the end, the finis operantis); one’s object is immoral no matter how good one’s end.”
The intention is the end chosen by the person who acts (finis agentis). The moral object is the end toward which the chosen act is inherently ordered (finis actus). Both fonts proceed from the will, from the free choice of the human person, toward different ends. But the intention of the person does not determine the moral object. The act is intentionally chosen, but in choosing any concrete act, the person necessarily also chooses its inherent meaning (the intrinsic ordering of the act) as determined by the object.
Smith further explains that: “If an act (‘some performative behavior’) is intrinsically evil, no matter what intention the agent has, the act remains evil.”
Even if the person does not intend or desire the end of the act (finis actus), he still chooses that end by choosing an act intrinsically ordered toward that end. So a good intention does not transform an intrinsically evil act into a good act.
[Janet E. Smith, The Morality of Condom Use by HIV-Infected Spouses, The Thomist 70 (2006): 27-69]