Theory of orientation textures due to surface energy anisotropies