Transferred intent is a concept that allows for the guilt to follow the action, regardless of who the victim is. That way, if Gus tries to kill Bill by shooting him, but misses and kills Rick instead, Gus may be found just as criminally liable for the death of Rick as he would have been for the death of Bill, had he succeeded in his intention. The doctrine of transferred intent is borrowed from tort law and applied in a criminal law context.
The overwhelming majority of transferred intent cases involve people missing their true target with firearms or thrown projectiles of some kind, which led these cases to be referred to as "bad aim" cases. However, if Claudius tries to kill Hamlet by poison and his wife drinks the fatal cup instead, then the doctrine of transferred intent may allow Claudius to be found as guilty of his wife's death as he would have been had be succeeded in the murder of Hamlet. Likewise with arson, sexual assault, larceny and every other crime: if the defendant perpetrates the act, and there is a victim, then the defendant may be punished no matter who the victim was or was intended to be.
In general, criminal courts have restricted the use of the transferred intent doctrine to situations of like kind. For example, if Gus tries to shoot Bill, but instead breaks Rick's window and puts a hole in his wall, then Gus will probably not be found guilty of malicious injury to property. His intention to harm Bill's person is of a different kind than the desire to harm property, and therefor intent will probably not be transferred.