A woman died from a heart attack after she was raped by a stranger while unconscious on a park bench, a court has been told.