How to switch motor outputs and use E1 as X, in Marlin firmware?
When using Marlin firmware you could easily change the pin layout of the extra extruder (E1) with the broken X stepper pins by changing the pins_RAMPS.h file.

Download the firmware and open the firmware project in Arduino IDE. Navigate to the "Steppers" section of the pins_RAMPS.h file and replace:

#define X_STEP_PIN         54
#define X_DIR_PIN          55
#define X_ENABLE_PIN       38
#define X_CS_PIN           53


for:

#define X_STEP_PIN         36
#define X_DIR_PIN          34
#define X_ENABLE_PIN       30
#define X_CS_PIN           44


and also change:

#define E1_STEP_PIN        36
#define E1_DIR_PIN         34
#define E1_ENABLE_PIN      30
#define E1_CS_PIN          44


to:

#define E1_STEP_PIN        54
#define E1_DIR_PIN         55
#define E1_ENABLE_PIN      38
#define E1_CS_PIN          53


When the file is changed an saved, build and upload code to your board and plug the connector of the X stepper into the E1 header.