An inverse function theorem for free groups