GSR MORTGAGE LOAN TRUST 2004-12 MORTGAGE PASS-THROUGH CERTIFICATES SERIES 2004-12 TRUST AGREEMENT among GS MORTGAGE SECURITIES CORP., as Depositor, and WELLS FARGO BANK, N.A., as Securities Administrator Dated as of October 1, 2004