Preparation of titanium(IV) phosphates