Maximum likelihood and efficient use of quantum resources in the alignment of reference frames