We have used the technique of small-angle neutron scattering to observe magnetic flux lines directly in a YBa2Cu3O7 single crystal at fields higher than previously reported. For field directions close to perpendicular to the CuO2 planes, we find that the flux lattice structure changes smoothly from a distorted triangular coordination to nearly perfectly square as the magnetic induction approaches 11 T. The orientation of the square flux lattice is as expected from recent d-wave theories but is 45 degrees from that recently observed in La(1.83)Sr(0.17)CuO(4+delta).