When does the bread and wine become Body and Blood? Exactly when during the Mass does transubstantiation occur? I am aware that it occurs during the Eucharistic Prayer, but at exactly what moment? Would this change if a priest were to consecrate outside of the Eucharistic Prayer? Why does the Church teach that it occurs at that moment?

It would be helpful to have a direct quote from a document published by the Church that makes a direct statement on when the exact moment is (for example, does it occur before or after a certain word or phrase is said?), both for the bread and for the wine. If both older and more recent sources could be provided, that would be especially helpful. If there are different views within Catholicism, please include those and explain where they apply.
Transubstantiation occurs during the consecratory thanksgiving during the single act of worship called the liturgy of the Eucharist.

1377 The Eucharistic presence of Christ begins at the moment of the consecration and endures as long as the Eucharistic species subsist.
http://www.vatican.va/archive/ENG0015/__P41.HTM

During Mass the liturgy of the Eucharist begins a particular time and follows this structure:

1346 The liturgy of the Eucharist unfolds according to a fundamental structure which has been preserved throughout the centuries down to our own day. It displays two great parts that form a fundamental unity:


the gathering, the liturgy of the Word, with readings, homily and general intercessions;
the liturgy of the Eucharist, with the presentation of the bread and wine, the consecratory thanksgiving, and communion.
The liturgy of the Word and liturgy of the Eucharist together form &quot;one single act of worship&quot;;170 The Eucharistic table set for us is the table both of the Word of God and of the Body of the Lord.
http://www.vatican.va/archive/ENG0015/__P40.HTM

The consecratory thanksgiving is the moment when the priest holds up the bread and repeats the words of Christ: &quot;This is my body ...&quot; and so on. Likewise, he says the same for the wine &quot;This is the cup ... &quot; and so on.

1412 The essential signs of the Eucharistic sacrament are wheat bread and grape wine, on which the blessing of the Holy Spirit is invoked and the priest pronounces the words of consecration spoken by Jesus during the Last Supper: &quot;This is my body which will be given up for you.... This is the cup of my blood....&quot;
1413 By the consecration the transubstantiation of the bread and wine into the Body and Blood of Christ is brought about.
http://www.vatican.va/archive/ENG0015/__P44.HTM

Now one might ask: what if the priest does not finish the consecration for some reason? Say he faints. The wording of the Catechism does not address this directly except it does simply say this in the canon law:

Can. 927 It is absolutely wrong, even in urgent and extreme necessity, to consecrate one element without the other, or even to consecrate both outside the eucharistic celebration.
http://www.intratext.com/IXT/ENG0017/__P39.HTM

Seemingly, then, the consecration must be finished despite any circumstances. This bit of canon law also implies that it is possible to consecrate the bread but not the wine, however serious a sin it might be.
This further leads to another question: suppose communion, the last part of the liturgy, is not achieved -- is the bread and wine still Body and Blood? It seems yes because of what is stated in 1376. The &quot;presence of Christ ... endures as long as the Eucharistic species subsist.&quot; Once transubstantiated the Body and Blood are Body and Blood so long as they exist. I assume then their destruction by eating or rot or other leaves them as not Body and Blood. However, not finishing the eucharistic celebration may be 'absolutely wrong' as well in light of the Canon Law quote above (I really cannot speak authoritatively on that).
Why does it occur at that moment and not some other? 1376 (below) states that it is &quot;Because Christ our Redeemer said that it was truly his body that he was offering under the species of bread&quot; at the last supper. So this statement argues both why transubstantiation occurs and when, and, subsequently, why it occurs at that time.
The definition of transubstantiation:

1376 The Council of Trent summarizes the Catholic faith by declaring: &quot;Because Christ our Redeemer said that it was truly his body that he was offering under the species of bread, it has always been the conviction of the Church of God, and this holy Council now declares again, that by the consecration of the bread and wine there takes place a change of the whole substance of the bread into the substance of the body of Christ our Lord and of the whole substance of the wine into the substance of his blood. This change the holy Catholic Church has fittingly and properly called transubstantiation.&quot;
http://www.vatican.va/archive/ENG0015/__P41.HTM

I don't have easy access to older items, however, 1376 is a quote from the Council of Trent (1500 something).

SOURCES
Catechism of the Catholic Church
Code of Canon Law