Better I think to use images that have been photographed perpendicular to the textured surface being photographed. By perpendicular I mean at right angles to the textured surface.
Here's how to set up a camera like that:
Also you will need to use a camera with a lens that doesn't distort the image, specifically not a phone camera which has a wide angle lens which will cause distortion/warping, but something like a DSLR or Mirrorless system with interchangeable lenses, and a good quality lens with perhaps a focal length of 50mm, which will help minimise any distortion. Obviously a tripod will help you position the camera accurately and help keep it in that position.
If there is slight distortion such as pincushion or barrel distortion, these can be automatically corrected in software such as Adobe Lightroom if a profile for the lens is available, or manually by eye.
When photographing textures, correct lighting is also required. The surface would need to be evenly lit so that no part is brighter or darker than another.
TLDR: really it's all about the camera and lens used, the lighting, and the positioning of the camera.
Converting images to make them seem as though they were taken perpendicularly is possible using raster image editing software, if the perspective distortion isn't too great. Software such as Photoshop/GIMP have perspective distortion functionality, but the quality won't be as good as a photo taken properly in the first place.
Photoshop has corrective perspective distortion functionality under Edit > Perspective Warp in the main menu. And GIMP has a Unified Transform tool with a perspective option in the tool options.