Structural basis of ferroelectricity in the bismuth titanate family