WOW . pretty small margin for error, because if I look at the foreground, I wouldn't have thought I did that.
That was with a Canon P&S - and I'm going with an iPhone 7 now - so anything wrong I do up front can only be "fixed" post shot.
Actually, it's pretty obvious in the photo. The two brick walls that are perpendicular to the facade are at different angles. You took this photo slightly to the right of the building which is why the perpendicular brick wall on the left hand side shows a more exposed view of the brick.
In the old view camera days (the ones that look like bellows), you'd adjust the front standard or back standard of the camera to adjust tilt and swing. A ground glass (for focusing) that has grid lines would be employed to help the photographer.
As mentioned above, 35mm SLR architectural photographers can use tilt-and-shift lenses to minimize the effect (it does not completely replace the full range of motion as the tilt-and-swing of a rail view camera. Many photographers probably use focusing screens with gridlines too, but it can be difficult to properly focus in a 35mm viewfinder to the extent required for architectural photography. Digital SLR photographers should be able to connect their cameras to laptops, allowing to preview and zoom the image for proper focusing and adjusting.
Here are a
few examples of a tilt-and-shift lens in action.
If you are going to continue with this type of photography with an iPhone, do not use the native iOS camera app. Use a third-party camera app that has gridlines. I know Camera+ is one such app, but I'm sure there are others.
Camera+ also has a basic level. There are other level measuring apps like Clinometer and Spyglass that will help level the camera before you take the shot.
For sure, you should be using a tripod. To take the picture, either use a short self-timer or use an earphone cord and press one of the volume control buttons as the shutter button.