Periods of Quaternionic Shimura Varieties. I.