Coherent twinning in complex oxides