Learning Physical Constraints with Neural Projections