Controlling the Phase of Titanium Dioxide for Nanophotonic Devices