Semiclassical theory of chaotic quantum resonances