Is there any official rule book for racing in Formula 1 to determine who's at fault in a racing incident, who has the apex/exit etc? I'm aware there's one describing other things like pit stops, starts, finishes and so on but I'm looking for one that talks about the rules of racing in corners and straight lines.
Your question asks for official rules regarding disputes over the apex. Unfortunately, we cannot provide a link to those rules because FIA sporting regulation says nothing about this (other than the generic rules for the track as a whole, as indicated in the other answer, which establish that cars must remain within the track limits). You will find FIA's official regulations online going back to 1998, but in none of them you'll find any mention about disputes over the apex.
According to the blog F1Metrics (2014):
Some of you might be surprised to learn that once a corner begins, the FIA sporting regulations have almost nothing to say, besides ruling that drivers must remain within the track limits! Here, the sporting regulations defer to long-established norms for racing, which may not be known by all fans, and which contain significant gray areas. (emphasis mine)
The most famous of these unwritten rules is the one that says that the attacker needs to have at least half his car's length alongside the defender. The same F1Metrics says:
Today, it is generally accepted that the attacker must be at least halfway alongside the defender when they reach the apex to have a reasonable claim to this piece of track. Moreover, the attacker should not have achieved this position by carrying too much speed to make the corner — this method is called dive-bombing.
These images, from the Williams Renault Formula 1 Motor Racing Book (1994), explain the scenarios:
However, as already explained, those are not official rues you can find in a FIA document.
For example Rule 4.2b from Appendix L:
Overtaking, according to the circumstances, may be carried out on either the right or the left.
A driver may not deliberately leave the track without justifiable reason.
More than one change of direction to defend a position is not permitted. Any driver moving back towards the racing line, having earlier defended his position offline, should leave at least one car width between his own car and the edge of the track on the approach to the corner.
However, manoeuvres liable to hinder other drivers, such as deliberate crowding of a car beyond the edge of the track or any other abnormal change of direction, are strictly prohibited.